function add_li(n) {
    var html = '<div class="none editor-box editor-box_'+n+'">\n' +
        '                    <div class="editor-title">\n' +
        '                        <label>标题<span class="hint">（必填）</span> </label>\n' +
        '                        <input id="title'+n+'" placeholder="请在这里输入标题" maxlength="64" class="layui-input" name="data['+n+'][title]" oninput="inputChange(this,'+n+');">\n' +
        '                    </div>\n' +
        '                    <div class="editor-author">\n' +
        '                        <label>作者<span class="hint">（选填）</span></label>\n' +
        '                        <input id="author'+n+'" placeholder="请输入作者" maxlength="16" class="layui-input" name="data['+n+'][author]">\n' +
        '                    </div>\n' +
        '                    <div class="editor-cover">\n' +
        '                        <label>封面<span class="hint">（图片建议尺寸：900 x 500像素 必填）</span></label>\n' +
        '                        <div class="layui-input-block img-upload-wx">\n' +
        '                            <div class="upload-img-block">\n' +
        '                                <div class="upload-img-box upload-img-box'+n+'" onclick="GetUploadify(1,\'\',\'allimg\',\'call_back_'+n+'\')">\n' +
        '                                    <div id="uploadImg" class="upload-default">' +
        '                                       <div id="preview_uploadImg'+n+'" class="preview_img" onclick="GetUploadify(1,\'\',\'allimg\',\'call_back_'+n+'\')">\n' +
        '                                            <div class="upload"><i class="iconfont iconshangchuan"></i><p>点击上传</p></div>\n' +
        '                                        </div>\n' +
        '                                    </div>\n' +
        '                                    <input class="layui-upload-file" type="file" accept="" name="file">\n' +
        '                                    <div class="operation">\n' +
        '                                        <div> ' +
        '<i title="编辑" onclick="GetUploadify(1,\'\',\'allimg\',\'call_back_'+n+'\')" class="layui-icon layui-icon-edit js-replace" style="margin-right: 20px;"></i>\n' +
        '    <i title="删除" onclick="del_litpic(this,'+n+')" class="layui-icon layui-icon-delete js-delete"></i>'+
        '</div>\n' +
        // '                                        <div class="replace_img js-replace">点击替换</div>\n' +
        '                                    </div>\n' +
        '                                    <input type="hidden" name="data['+n+'][litpic]" id="litpic'+n+'">\n' +
        '                                </div>\n' +
        '                            </div>\n' +
        '                        </div>\n' +
        // '                        <label for="show_cover_pic" class="editor-msg-label">\n' +
        // '                            <input type="checkbox" id="show_cover_pic'+n+'" name="data['+n+'][show_cover_pic]" value="0">\n' +
        // '                            封面图片显示在正文中\n' +
        // '                        </label>\n' +
        '                    </div>\n' +
        '                    <div class="editor-content">\n' +
        '                        <label>正文<span class="hint">（必填）</span></label>\n' +
        '                        <div id="editor" class="edui-default">\n' +
        '                            <textarea class="span12 ckeditor" id="intro_'+n+'" name="data['+n+'][intro]" title=""></textarea>\n' +
        '                            <div class="opt-moreOper" style="margin-top: 20px;">\n' +
        '                                <p>\n' +
        '                                    <a href="javascript:void(0);" onclick="remote_to_local('+n+');" class="ncap-btn2">远程图片本地化</a>&nbsp;\n' +
        '                                    <a href="javascript:void(0);" onclick="replace_links('+n+');" class="ncap-btn2">清除非本站链接</a>&nbsp;\n' +
        '                                </p>\n' +
        '                            </div>\n' +
        '                        </div>\n' +
        '                    </div>\n' +
        '                    <div class="editor-url">\n' +
        '                        <label>原文链接<span class="hint">（选填）</span></label>\n' +
        '                        <input id="original_url'+n+'" placeholder="例：http://www.example.com" maxlength="100" class="layui-input" name="data['+n+'][original_url]">\n' +
        '                    </div>\n' +
        '                </div>' +
        '<script type="text/javascript">\n' +
        '    var ue_intro_'+n+' = UE.getEditor("intro_'+n+'", {\n' +
        '        serverUrl: ueditor_url,\n' +
        '        zIndex: 999,\n' +
        '        initialFrameWidth: "100%", //初化宽度\n' +
        '        initialFrameHeight: 450, //初化高度\n' +
        '        focus: false, //初始化时，是否让编辑器获得焦点true或false\n' +
        '        maximumWords: 99999,\n' +
        '        removeFormatAttributes: \'class,style,lang,width,height,align,hspace,valign\',//允许的最大字符数 \'fullscreen\',\n' +
        '        pasteplain: false, //是否默认为纯文本粘贴。false为不使用纯文本粘贴，true为使用纯文本粘贴\n' +
        '        autoHeightEnabled: false,\n' +
        '        toolbars: ueditor_toolbars\n' +
        '    });\n' +
        '\n' +
        // '    ue_intro_'+n+'.ready(function() {\n' +
        // '        ue_intro_'+n+'.setContent("");\n' +
        // '    });\n' +
        '\n' +
        '    //必须在提交前渲染编辑器；\n' +
        '    function intro_'+n+'() {\n' +
        '        //判断编辑模式状态:0表示【源代码】HTML视图；1是【设计】视图,即可见即所得；-1表示不可用\n' +
        '        if (UE.getEditor("intro_'+n+'").queryCommandState(\'source\') != 0) {\n' +
        '            UE.getEditor("intro_'+n+'").execCommand(\'source\'); //切换到【设计】视图\n' +
        '        }\n' +
        '    }' +
        'function call_back_'+n+'(fileurl_tmp){\n' +
        '    call_back('+n+',fileurl_tmp);'+
        '}\n' +
        '</script>';
    $("#graphic_message").append(html);
}


function inputChange(obj,n) {
    var val = $(obj).val();
    $("#show_title"+n).text(val);
}

//删除图片
function del_litpic(obj,n) {
    event.stopPropagation();
    $("#preview_uploadImg"+n).html("<div class=\"upload\"><i class=\"iconfont iconshangchuan\"></i><p>点击上传</p></div>");
    $(".li"+n+" .div_content img").remove();
    var title = '封面图片';
    if (0 < n){
        title = '缩略图';
    }
    $(".li"+n+" .div_content").prepend("<div class=\"empty-img empty-img"+n+"\">\n" +
        "                                     <span class=\"empty-hint\">"+title+"</span>\n" +
        "                                 </div>\n");
    $("#litpic"+n).val('');
    $(".upload-img-box"+n).removeClass('hover');
}
//图片回调
function call_back(n,fileurl_tmp)
{
    $("#preview_uploadImg"+n).html("<img src='"+fileurl_tmp+"' class=\"img_prev\">");
    $("#litpic"+n).val(fileurl_tmp);
    $(".upload-img-box"+n).addClass('hover');
    $(".empty-img"+n).remove();
    $(".li"+n+" .div_content img").remove();
    $(".li"+n+" .div_content").prepend("<img src='"+fileurl_tmp+"'>");
}